@(id : Long, types : List[models.Type], typeForm: Form[models.Type])

@import helper._

@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.render) } 

@main("Todo list") { 
    <header class="topbar">
        <h1 class="fill" align="center">
            <a href="@routes.Application.index()">
				Plateforme de gestion de catalogue de produits
            </a>
        </h1>
    </header>
     @if(flash.containsKey("success")) {
        <div align="center" class="alert-message success">
            <strong>Done!</strong> @flash.get("success")
        </div>
    }else{
	    @if(flash.containsKey("error")){
	    	<div align="center" class="alert-message error">
	            <strong>Done!</strong> @flash.get("error")
	        </div>
	    } 
    }
    <h2 style="padding:15px">Add a new type</h2>
    
    @form(routes.Types.add()) {
    <fieldset>
        @inputText(typeForm("nType"), '_label -> "Type name" )
        @inputText(typeForm("categorie"), '_label -> "Category name")
                
        <div class="actions">
            <input type="submit" value="Create this type" class="btn primary">            
        </div>
    </fieldset>         
    }
    
    <table style="width:500px; border:0; cellpadding:0; cellspacing:0; rules:none">
	     @for(_type <- types) { 
			  <tr>
				  @form(routes.Types.deleteType(_type.id)) {
		    		<th style="width: 250px; border:0; cellpadding:0; cellspacing:0; rules:none">@_type.nType</th>
		    		<th style="width: 150px; border:0; cellpadding:0; cellspacing:0; rules:none">@_type.categorie</th>		    		
				    <th style="width: 40px; border:0; cellpadding:0; cellspacing:0; rules:none"><input class="btn small" type="submit" value="Delete"></th>
				    <th style="width: 60px; border:0; cellpadding:0; cellspacing:0; rules:none"><input class="btn small" value="Cr&eacute;er une fiche"></th>
			      }
			  </tr>
		}
	</table>    
}